package com.ithei.date.mydate;

import java.time.LocalDateTime;
import java.util.Scanner;

public class 一年中的二月天数 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入年份:  ");
        int year = sc.nextInt();
        LocalDateTime ldt1 = LocalDateTime.of(year, 3, 1, 12, 12, 12);
        LocalDateTime ldt2 = LocalDateTime.of(year, 2, 1, 12, 12, 12);
        LocalDateTime localDateTime = ldt1.plusDays(-1);
        int dayOfMonth = localDateTime.getDayOfMonth();
        System.out.println("采用的是减一天: "+year + "这一年的二月有:   " + dayOfMonth);
        int day = ldt1.getDayOfYear() - ldt2.getDayOfYear();
        System.out.println("采用的是月份方法:   "+year + "这一年的二月有:   " + day);


    }
}
